import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
import axios from 'axios'
import store from './store'
import 'default-passive-events'
import storage from "good-storage"

Vue.prototype.$http = axios
//请求路径
axios.defaults.baseURL = 'http://8.140.135.252:8080/'
Vue.config.productionTip = false
axios.defaults.withCredentials = true

Vue.prototype.$storage = storage;

new Vue({
  router,
  store,
  localStorage,
  render: h => h(App)
}).$mount('#app')

Vue.prototype.convertTime = function (timestampe) {
  var time = new Date(timestampe);
  var y = time.getFullYear();
  var m = time.getMonth() + 1;
  var d = time.getDate();
  var h = time.getHours();
  var mm = time.getMinutes();
  var s = time.getSeconds();
  return y + "-" + this.add0(m) + "-" + this.add0(d) + "-" + this.add0(h) + ":" + this.add0(mm) + ":" + this.add0(s);
};

Vue.prototype.add0 = function (m) {
  return m < 10 ? '0' + m : m
}